import * as echarts from 'echarts'

export const chartStyle = {
  tooltip: {
    trigger: 'axis',
    axisPointer: {
      type: 'shadow',
    },
  },
  grid: {
    left: '45px',
    right: '4%',
    bottom: '25px',
    containLabel: true,
  },
  backgroundColor: '#f2f8fb',
  xAxisObj: {
    axisTick: false,
    axisLabel: {
      textStyle: {
        color: '#f0f0f0',
        fontSize: '12',
      },
    },
    splitLine: {
      show: true,
      lineStyle: {
        color: 'rgba(240, 240, 240, 0.1)',
      },
    },
    axisLine: {
      color: '#f0f0f0',
      lineStyle: {
        color: 'rgba(240, 240, 240, 0.1)',
      },
    },
  },
  yAxisObj: {
    type: 'value',
    axisTick: false,
    boundaryGap: false,
    splitLine: {
      show: true,
      lineStyle: {
        color: 'rgba(240, 240, 240, 0.1)',
      },
    },
    axisLine: {
      lineStyle: {
        color: 'rgba(240, 240, 240, 0.1)',
      },
    },
    axisLabel: {
      textStyle: {
        color: '#f0f0f0',
        fontSize: 12,
      },
    },
  },
  seriesLineObj: function (color0, color1) {
    return {
      type: 'line',
      smooth: true,
      showSymbol: false,
      itemStyle: {
        color: color0,
        lineStyle: {
          color: color0,
          width: 0,
        },
      },
      areaStyle: {
        color: new echarts.graphic.LinearGradient(0, 0, 0, 1, [
          {
            offset: 0,
            color: color0,
          },
          {
            offset: 1,
            color: color1,
          },
        ]),
      },
    }
  },
}
